{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.system(\"pip install threading\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import csv\n",
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.sin(math.pi/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "254, 249, 244, 239, 234, 229, 224, 219, 214, 209, 204, 198, 193, 188, 183, 178, 173, 168, 163, 158, 153, 147, 142, 137, 132, 127, 122, 117, 112, 107, 102, 96, 91, 86, 81, 76, 71, 66, 61, 56, 51, 45, 40, 35, 30, 25, 20, 15, 10, 5, "
     ]
    }
   ],
   "source": [
    "for i in range(0,50):\n",
    "    print(int(255/50*(50-i)),end=\", \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on module threading:\n",
      "\n",
      "NAME\n",
      "    threading - Thread module emulating a subset of Java's threading model.\n",
      "\n",
      "CLASSES\n",
      "    builtins.Exception(builtins.BaseException)\n",
      "        builtins.RuntimeError\n",
      "            BrokenBarrierError\n",
      "    builtins.object\n",
      "        _thread._local\n",
      "        Barrier\n",
      "        Condition\n",
      "        Event\n",
      "        Semaphore\n",
      "            BoundedSemaphore\n",
      "        Thread\n",
      "            Timer\n",
      "    \n",
      "    class Barrier(builtins.object)\n",
      "     |  Implements a Barrier.\n",
      "     |  \n",
      "     |  Useful for synchronizing a fixed number of threads at known synchronization\n",
      "     |  points.  Threads block on 'wait()' and are simultaneously once they have all\n",
      "     |  made that call.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __init__(self, parties, action=None, timeout=None)\n",
      "     |      Create a barrier, initialised to 'parties' threads.\n",
      "     |      \n",
      "     |      'action' is a callable which, when supplied, will be called by one of\n",
      "     |      the threads after they have all entered the barrier and just prior to\n",
      "     |      releasing them all. If a 'timeout' is provided, it is uses as the\n",
      "     |      default for all subsequent 'wait()' calls.\n",
      "     |  \n",
      "     |  abort(self)\n",
      "     |      Place the barrier into a 'broken' state.\n",
      "     |      \n",
      "     |      Useful in case of error.  Any currently waiting threads and threads\n",
      "     |      attempting to 'wait()' will have BrokenBarrierError raised.\n",
      "     |  \n",
      "     |  reset(self)\n",
      "     |      Reset the barrier to the initial state.\n",
      "     |      \n",
      "     |      Any threads currently waiting will get the BrokenBarrier exception\n",
      "     |      raised.\n",
      "     |  \n",
      "     |  wait(self, timeout=None)\n",
      "     |      Wait for the barrier.\n",
      "     |      \n",
      "     |      When the specified number of threads have started waiting, they are all\n",
      "     |      simultaneously awoken. If an 'action' was provided for the barrier, one\n",
      "     |      of the threads will have executed that callback prior to returning.\n",
      "     |      Returns an individual index number from 0 to 'parties-1'.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  broken\n",
      "     |      Return True if the barrier is in a broken state.\n",
      "     |  \n",
      "     |  n_waiting\n",
      "     |      Return the number of threads currently waiting at the barrier.\n",
      "     |  \n",
      "     |  parties\n",
      "     |      Return the number of threads required to trip the barrier.\n",
      "    \n",
      "    class BoundedSemaphore(Semaphore)\n",
      "     |  Implements a bounded semaphore.\n",
      "     |  \n",
      "     |  A bounded semaphore checks to make sure its current value doesn't exceed its\n",
      "     |  initial value. If it does, ValueError is raised. In most situations\n",
      "     |  semaphores are used to guard resources with limited capacity.\n",
      "     |  \n",
      "     |  If the semaphore is released too many times it's a sign of a bug. If not\n",
      "     |  given, value defaults to 1.\n",
      "     |  \n",
      "     |  Like regular semaphores, bounded semaphores manage a counter representing\n",
      "     |  the number of release() calls minus the number of acquire() calls, plus an\n",
      "     |  initial value. The acquire() method blocks if necessary until it can return\n",
      "     |  without making the counter negative. If not given, value defaults to 1.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      BoundedSemaphore\n",
      "     |      Semaphore\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __init__(self, value=1)\n",
      "     |      Initialize self.  See help(type(self)) for accurate signature.\n",
      "     |  \n",
      "     |  release(self)\n",
      "     |      Release a semaphore, incrementing the internal counter by one.\n",
      "     |      \n",
      "     |      When the counter is zero on entry and another thread is waiting for it\n",
      "     |      to become larger than zero again, wake up that thread.\n",
      "     |      \n",
      "     |      If the number of releases exceeds the number of acquires,\n",
      "     |      raise a ValueError.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from Semaphore:\n",
      "     |  \n",
      "     |  __enter__ = acquire(self, blocking=True, timeout=None)\n",
      "     |      Acquire a semaphore, decrementing the internal counter by one.\n",
      "     |      \n",
      "     |      When invoked without arguments: if the internal counter is larger than\n",
      "     |      zero on entry, decrement it by one and return immediately. If it is zero\n",
      "     |      on entry, block, waiting until some other thread has called release() to\n",
      "     |      make it larger than zero. This is done with proper interlocking so that\n",
      "     |      if multiple acquire() calls are blocked, release() will wake exactly one\n",
      "     |      of them up. The implementation may pick one at random, so the order in\n",
      "     |      which blocked threads are awakened should not be relied on. There is no\n",
      "     |      return value in this case.\n",
      "     |      \n",
      "     |      When invoked with blocking set to true, do the same thing as when called\n",
      "     |      without arguments, and return true.\n",
      "     |      \n",
      "     |      When invoked with blocking set to false, do not block. If a call without\n",
      "     |      an argument would block, return false immediately; otherwise, do the\n",
      "     |      same thing as when called without arguments, and return true.\n",
      "     |      \n",
      "     |      When invoked with a timeout other than None, it will block for at\n",
      "     |      most timeout seconds.  If acquire does not complete successfully in\n",
      "     |      that interval, return false.  Return true otherwise.\n",
      "     |  \n",
      "     |  __exit__(self, t, v, tb)\n",
      "     |  \n",
      "     |  acquire(self, blocking=True, timeout=None)\n",
      "     |      Acquire a semaphore, decrementing the internal counter by one.\n",
      "     |      \n",
      "     |      When invoked without arguments: if the internal counter is larger than\n",
      "     |      zero on entry, decrement it by one and return immediately. If it is zero\n",
      "     |      on entry, block, waiting until some other thread has called release() to\n",
      "     |      make it larger than zero. This is done with proper interlocking so that\n",
      "     |      if multiple acquire() calls are blocked, release() will wake exactly one\n",
      "     |      of them up. The implementation may pick one at random, so the order in\n",
      "     |      which blocked threads are awakened should not be relied on. There is no\n",
      "     |      return value in this case.\n",
      "     |      \n",
      "     |      When invoked with blocking set to true, do the same thing as when called\n",
      "     |      without arguments, and return true.\n",
      "     |      \n",
      "     |      When invoked with blocking set to false, do not block. If a call without\n",
      "     |      an argument would block, return false immediately; otherwise, do the\n",
      "     |      same thing as when called without arguments, and return true.\n",
      "     |      \n",
      "     |      When invoked with a timeout other than None, it will block for at\n",
      "     |      most timeout seconds.  If acquire does not complete successfully in\n",
      "     |      that interval, return false.  Return true otherwise.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from Semaphore:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "    \n",
      "    class BrokenBarrierError(builtins.RuntimeError)\n",
      "     |  Unspecified run-time error.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      BrokenBarrierError\n",
      "     |      builtins.RuntimeError\n",
      "     |      builtins.Exception\n",
      "     |      builtins.BaseException\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from builtins.RuntimeError:\n",
      "     |  \n",
      "     |  __init__(self, /, *args, **kwargs)\n",
      "     |      Initialize self.  See help(type(self)) for accurate signature.\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from builtins.BaseException:\n",
      "     |  \n",
      "     |  __delattr__(self, name, /)\n",
      "     |      Implement delattr(self, name).\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      helper for pickle\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  __setattr__(self, name, value, /)\n",
      "     |      Implement setattr(self, name, value).\n",
      "     |  \n",
      "     |  __setstate__(...)\n",
      "     |  \n",
      "     |  __str__(self, /)\n",
      "     |      Return str(self).\n",
      "     |  \n",
      "     |  with_traceback(...)\n",
      "     |      Exception.with_traceback(tb) --\n",
      "     |      set self.__traceback__ to tb and return self.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from builtins.BaseException:\n",
      "     |  \n",
      "     |  __cause__\n",
      "     |      exception cause\n",
      "     |  \n",
      "     |  __context__\n",
      "     |      exception context\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |  \n",
      "     |  __suppress_context__\n",
      "     |  \n",
      "     |  __traceback__\n",
      "     |  \n",
      "     |  args\n",
      "    \n",
      "    class Condition(builtins.object)\n",
      "     |  Class that implements a condition variable.\n",
      "     |  \n",
      "     |  A condition variable allows one or more threads to wait until they are\n",
      "     |  notified by another thread.\n",
      "     |  \n",
      "     |  If the lock argument is given and not None, it must be a Lock or RLock\n",
      "     |  object, and it is used as the underlying lock. Otherwise, a new RLock object\n",
      "     |  is created and used as the underlying lock.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __enter__(self)\n",
      "     |  \n",
      "     |  __exit__(self, *args)\n",
      "     |  \n",
      "     |  __init__(self, lock=None)\n",
      "     |      Initialize self.  See help(type(self)) for accurate signature.\n",
      "     |  \n",
      "     |  __repr__(self)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  notify(self, n=1)\n",
      "     |      Wake up one or more threads waiting on this condition, if any.\n",
      "     |      \n",
      "     |      If the calling thread has not acquired the lock when this method is\n",
      "     |      called, a RuntimeError is raised.\n",
      "     |      \n",
      "     |      This method wakes up at most n of the threads waiting for the condition\n",
      "     |      variable; it is a no-op if no threads are waiting.\n",
      "     |  \n",
      "     |  notifyAll = notify_all(self)\n",
      "     |  \n",
      "     |  notify_all(self)\n",
      "     |      Wake up all threads waiting on this condition.\n",
      "     |      \n",
      "     |      If the calling thread has not acquired the lock when this method\n",
      "     |      is called, a RuntimeError is raised.\n",
      "     |  \n",
      "     |  wait(self, timeout=None)\n",
      "     |      Wait until notified or until a timeout occurs.\n",
      "     |      \n",
      "     |      If the calling thread has not acquired the lock when this method is\n",
      "     |      called, a RuntimeError is raised.\n",
      "     |      \n",
      "     |      This method releases the underlying lock, and then blocks until it is\n",
      "     |      awakened by a notify() or notify_all() call for the same condition\n",
      "     |      variable in another thread, or until the optional timeout occurs. Once\n",
      "     |      awakened or timed out, it re-acquires the lock and returns.\n",
      "     |      \n",
      "     |      When the timeout argument is present and not None, it should be a\n",
      "     |      floating point number specifying a timeout for the operation in seconds\n",
      "     |      (or fractions thereof).\n",
      "     |      \n",
      "     |      When the underlying lock is an RLock, it is not released using its\n",
      "     |      release() method, since this may not actually unlock the lock when it\n",
      "     |      was acquired multiple times recursively. Instead, an internal interface\n",
      "     |      of the RLock class is used, which really unlocks it even when it has\n",
      "     |      been recursively acquired several times. Another internal interface is\n",
      "     |      then used to restore the recursion level when the lock is reacquired.\n",
      "     |  \n",
      "     |  wait_for(self, predicate, timeout=None)\n",
      "     |      Wait until a condition evaluates to True.\n",
      "     |      \n",
      "     |      predicate should be a callable which result will be interpreted as a\n",
      "     |      boolean value.  A timeout may be provided giving the maximum time to\n",
      "     |      wait.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "    \n",
      "    class Event(builtins.object)\n",
      "     |  Class implementing event objects.\n",
      "     |  \n",
      "     |  Events manage a flag that can be set to true with the set() method and reset\n",
      "     |  to false with the clear() method. The wait() method blocks until the flag is\n",
      "     |  true.  The flag is initially false.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __init__(self)\n",
      "     |      Initialize self.  See help(type(self)) for accurate signature.\n",
      "     |  \n",
      "     |  clear(self)\n",
      "     |      Reset the internal flag to false.\n",
      "     |      \n",
      "     |      Subsequently, threads calling wait() will block until set() is called to\n",
      "     |      set the internal flag to true again.\n",
      "     |  \n",
      "     |  isSet = is_set(self)\n",
      "     |  \n",
      "     |  is_set(self)\n",
      "     |      Return true if and only if the internal flag is true.\n",
      "     |  \n",
      "     |  set(self)\n",
      "     |      Set the internal flag to true.\n",
      "     |      \n",
      "     |      All threads waiting for it to become true are awakened. Threads\n",
      "     |      that call wait() once the flag is true will not block at all.\n",
      "     |  \n",
      "     |  wait(self, timeout=None)\n",
      "     |      Block until the internal flag is true.\n",
      "     |      \n",
      "     |      If the internal flag is true on entry, return immediately. Otherwise,\n",
      "     |      block until another thread calls set() to set the flag to true, or until\n",
      "     |      the optional timeout occurs.\n",
      "     |      \n",
      "     |      When the timeout argument is present and not None, it should be a\n",
      "     |      floating point number specifying a timeout for the operation in seconds\n",
      "     |      (or fractions thereof).\n",
      "     |      \n",
      "     |      This method returns the internal flag on exit, so it will always return\n",
      "     |      True except if a timeout is given and the operation times out.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "    \n",
      "    class Semaphore(builtins.object)\n",
      "     |  This class implements semaphore objects.\n",
      "     |  \n",
      "     |  Semaphores manage a counter representing the number of release() calls minus\n",
      "     |  the number of acquire() calls, plus an initial value. The acquire() method\n",
      "     |  blocks if necessary until it can return without making the counter\n",
      "     |  negative. If not given, value defaults to 1.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __enter__ = acquire(self, blocking=True, timeout=None)\n",
      "     |  \n",
      "     |  __exit__(self, t, v, tb)\n",
      "     |  \n",
      "     |  __init__(self, value=1)\n",
      "     |      Initialize self.  See help(type(self)) for accurate signature.\n",
      "     |  \n",
      "     |  acquire(self, blocking=True, timeout=None)\n",
      "     |      Acquire a semaphore, decrementing the internal counter by one.\n",
      "     |      \n",
      "     |      When invoked without arguments: if the internal counter is larger than\n",
      "     |      zero on entry, decrement it by one and return immediately. If it is zero\n",
      "     |      on entry, block, waiting until some other thread has called release() to\n",
      "     |      make it larger than zero. This is done with proper interlocking so that\n",
      "     |      if multiple acquire() calls are blocked, release() will wake exactly one\n",
      "     |      of them up. The implementation may pick one at random, so the order in\n",
      "     |      which blocked threads are awakened should not be relied on. There is no\n",
      "     |      return value in this case.\n",
      "     |      \n",
      "     |      When invoked with blocking set to true, do the same thing as when called\n",
      "     |      without arguments, and return true.\n",
      "     |      \n",
      "     |      When invoked with blocking set to false, do not block. If a call without\n",
      "     |      an argument would block, return false immediately; otherwise, do the\n",
      "     |      same thing as when called without arguments, and return true.\n",
      "     |      \n",
      "     |      When invoked with a timeout other than None, it will block for at\n",
      "     |      most timeout seconds.  If acquire does not complete successfully in\n",
      "     |      that interval, return false.  Return true otherwise.\n",
      "     |  \n",
      "     |  release(self)\n",
      "     |      Release a semaphore, incrementing the internal counter by one.\n",
      "     |      \n",
      "     |      When the counter is zero on entry and another thread is waiting for it\n",
      "     |      to become larger than zero again, wake up that thread.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "    \n",
      "    class Thread(builtins.object)\n",
      "     |  A class that represents a thread of control.\n",
      "     |  \n",
      "     |  This class can be safely subclassed in a limited fashion. There are two ways\n",
      "     |  to specify the activity: by passing a callable object to the constructor, or\n",
      "     |  by overriding the run() method in a subclass.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)\n",
      "     |      This constructor should always be called with keyword arguments. Arguments are:\n",
      "     |      \n",
      "     |      *group* should be None; reserved for future extension when a ThreadGroup\n",
      "     |      class is implemented.\n",
      "     |      \n",
      "     |      *target* is the callable object to be invoked by the run()\n",
      "     |      method. Defaults to None, meaning nothing is called.\n",
      "     |      \n",
      "     |      *name* is the thread name. By default, a unique name is constructed of\n",
      "     |      the form \"Thread-N\" where N is a small decimal number.\n",
      "     |      \n",
      "     |      *args* is the argument tuple for the target invocation. Defaults to ().\n",
      "     |      \n",
      "     |      *kwargs* is a dictionary of keyword arguments for the target\n",
      "     |      invocation. Defaults to {}.\n",
      "     |      \n",
      "     |      If a subclass overrides the constructor, it must make sure to invoke\n",
      "     |      the base class constructor (Thread.__init__()) before doing anything\n",
      "     |      else to the thread.\n",
      "     |  \n",
      "     |  __repr__(self)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  getName(self)\n",
      "     |  \n",
      "     |  isAlive = is_alive(self)\n",
      "     |  \n",
      "     |  isDaemon(self)\n",
      "     |  \n",
      "     |  is_alive(self)\n",
      "     |      Return whether the thread is alive.\n",
      "     |      \n",
      "     |      This method returns True just before the run() method starts until just\n",
      "     |      after the run() method terminates. The module function enumerate()\n",
      "     |      returns a list of all alive threads.\n",
      "     |  \n",
      "     |  join(self, timeout=None)\n",
      "     |      Wait until the thread terminates.\n",
      "     |      \n",
      "     |      This blocks the calling thread until the thread whose join() method is\n",
      "     |      called terminates -- either normally or through an unhandled exception\n",
      "     |      or until the optional timeout occurs.\n",
      "     |      \n",
      "     |      When the timeout argument is present and not None, it should be a\n",
      "     |      floating point number specifying a timeout for the operation in seconds\n",
      "     |      (or fractions thereof). As join() always returns None, you must call\n",
      "     |      isAlive() after join() to decide whether a timeout happened -- if the\n",
      "     |      thread is still alive, the join() call timed out.\n",
      "     |      \n",
      "     |      When the timeout argument is not present or None, the operation will\n",
      "     |      block until the thread terminates.\n",
      "     |      \n",
      "     |      A thread can be join()ed many times.\n",
      "     |      \n",
      "     |      join() raises a RuntimeError if an attempt is made to join the current\n",
      "     |      thread as that would cause a deadlock. It is also an error to join() a\n",
      "     |      thread before it has been started and attempts to do so raises the same\n",
      "     |      exception.\n",
      "     |  \n",
      "     |  run(self)\n",
      "     |      Method representing the thread's activity.\n",
      "     |      \n",
      "     |      You may override this method in a subclass. The standard run() method\n",
      "     |      invokes the callable object passed to the object's constructor as the\n",
      "     |      target argument, if any, with sequential and keyword arguments taken\n",
      "     |      from the args and kwargs arguments, respectively.\n",
      "     |  \n",
      "     |  setDaemon(self, daemonic)\n",
      "     |  \n",
      "     |  setName(self, name)\n",
      "     |  \n",
      "     |  start(self)\n",
      "     |      Start the thread's activity.\n",
      "     |      \n",
      "     |      It must be called at most once per thread object. It arranges for the\n",
      "     |      object's run() method to be invoked in a separate thread of control.\n",
      "     |      \n",
      "     |      This method will raise a RuntimeError if called more than once on the\n",
      "     |      same thread object.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  daemon\n",
      "     |      A boolean value indicating whether this thread is a daemon thread.\n",
      "     |      \n",
      "     |      This must be set before start() is called, otherwise RuntimeError is\n",
      "     |      raised. Its initial value is inherited from the creating thread; the\n",
      "     |      main thread is not a daemon thread and therefore all threads created in\n",
      "     |      the main thread default to daemon = False.\n",
      "     |      \n",
      "     |      The entire Python program exits when no alive non-daemon threads are\n",
      "     |      left.\n",
      "     |  \n",
      "     |  ident\n",
      "     |      Thread identifier of this thread or None if it has not been started.\n",
      "     |      \n",
      "     |      This is a nonzero integer. See the thread.get_ident() function. Thread\n",
      "     |      identifiers may be recycled when a thread exits and another thread is\n",
      "     |      created. The identifier is available even after the thread has exited.\n",
      "     |  \n",
      "     |  name\n",
      "     |      A string used for identification purposes only.\n",
      "     |      \n",
      "     |      It has no semantics. Multiple threads may be given the same name. The\n",
      "     |      initial name is set by the constructor.\n",
      "    \n",
      "    ThreadError = class RuntimeError(Exception)\n",
      "     |  Unspecified run-time error.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      RuntimeError\n",
      "     |      Exception\n",
      "     |      BaseException\n",
      "     |      object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __init__(self, /, *args, **kwargs)\n",
      "     |      Initialize self.  See help(type(self)) for accurate signature.\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from BaseException:\n",
      "     |  \n",
      "     |  __delattr__(self, name, /)\n",
      "     |      Implement delattr(self, name).\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      helper for pickle\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  __setattr__(self, name, value, /)\n",
      "     |      Implement setattr(self, name, value).\n",
      "     |  \n",
      "     |  __setstate__(...)\n",
      "     |  \n",
      "     |  __str__(self, /)\n",
      "     |      Return str(self).\n",
      "     |  \n",
      "     |  with_traceback(...)\n",
      "     |      Exception.with_traceback(tb) --\n",
      "     |      set self.__traceback__ to tb and return self.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from BaseException:\n",
      "     |  \n",
      "     |  __cause__\n",
      "     |      exception cause\n",
      "     |  \n",
      "     |  __context__\n",
      "     |      exception context\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |  \n",
      "     |  __suppress_context__\n",
      "     |  \n",
      "     |  __traceback__\n",
      "     |  \n",
      "     |  args\n",
      "    \n",
      "    class Timer(Thread)\n",
      "     |  Call a function after a specified number of seconds:\n",
      "     |  \n",
      "     |  t = Timer(30.0, f, args=None, kwargs=None)\n",
      "     |  t.start()\n",
      "     |  t.cancel()     # stop the timer's action if it's still waiting\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      Timer\n",
      "     |      Thread\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __init__(self, interval, function, args=None, kwargs=None)\n",
      "     |      This constructor should always be called with keyword arguments. Arguments are:\n",
      "     |      \n",
      "     |      *group* should be None; reserved for future extension when a ThreadGroup\n",
      "     |      class is implemented.\n",
      "     |      \n",
      "     |      *target* is the callable object to be invoked by the run()\n",
      "     |      method. Defaults to None, meaning nothing is called.\n",
      "     |      \n",
      "     |      *name* is the thread name. By default, a unique name is constructed of\n",
      "     |      the form \"Thread-N\" where N is a small decimal number.\n",
      "     |      \n",
      "     |      *args* is the argument tuple for the target invocation. Defaults to ().\n",
      "     |      \n",
      "     |      *kwargs* is a dictionary of keyword arguments for the target\n",
      "     |      invocation. Defaults to {}.\n",
      "     |      \n",
      "     |      If a subclass overrides the constructor, it must make sure to invoke\n",
      "     |      the base class constructor (Thread.__init__()) before doing anything\n",
      "     |      else to the thread.\n",
      "     |  \n",
      "     |  cancel(self)\n",
      "     |      Stop the timer if it hasn't finished yet.\n",
      "     |  \n",
      "     |  run(self)\n",
      "     |      Method representing the thread's activity.\n",
      "     |      \n",
      "     |      You may override this method in a subclass. The standard run() method\n",
      "     |      invokes the callable object passed to the object's constructor as the\n",
      "     |      target argument, if any, with sequential and keyword arguments taken\n",
      "     |      from the args and kwargs arguments, respectively.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from Thread:\n",
      "     |  \n",
      "     |  __repr__(self)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  getName(self)\n",
      "     |  \n",
      "     |  isAlive = is_alive(self)\n",
      "     |      Return whether the thread is alive.\n",
      "     |      \n",
      "     |      This method returns True just before the run() method starts until just\n",
      "     |      after the run() method terminates. The module function enumerate()\n",
      "     |      returns a list of all alive threads.\n",
      "     |  \n",
      "     |  isDaemon(self)\n",
      "     |  \n",
      "     |  is_alive(self)\n",
      "     |      Return whether the thread is alive.\n",
      "     |      \n",
      "     |      This method returns True just before the run() method starts until just\n",
      "     |      after the run() method terminates. The module function enumerate()\n",
      "     |      returns a list of all alive threads.\n",
      "     |  \n",
      "     |  join(self, timeout=None)\n",
      "     |      Wait until the thread terminates.\n",
      "     |      \n",
      "     |      This blocks the calling thread until the thread whose join() method is\n",
      "     |      called terminates -- either normally or through an unhandled exception\n",
      "     |      or until the optional timeout occurs.\n",
      "     |      \n",
      "     |      When the timeout argument is present and not None, it should be a\n",
      "     |      floating point number specifying a timeout for the operation in seconds\n",
      "     |      (or fractions thereof). As join() always returns None, you must call\n",
      "     |      isAlive() after join() to decide whether a timeout happened -- if the\n",
      "     |      thread is still alive, the join() call timed out.\n",
      "     |      \n",
      "     |      When the timeout argument is not present or None, the operation will\n",
      "     |      block until the thread terminates.\n",
      "     |      \n",
      "     |      A thread can be join()ed many times.\n",
      "     |      \n",
      "     |      join() raises a RuntimeError if an attempt is made to join the current\n",
      "     |      thread as that would cause a deadlock. It is also an error to join() a\n",
      "     |      thread before it has been started and attempts to do so raises the same\n",
      "     |      exception.\n",
      "     |  \n",
      "     |  setDaemon(self, daemonic)\n",
      "     |  \n",
      "     |  setName(self, name)\n",
      "     |  \n",
      "     |  start(self)\n",
      "     |      Start the thread's activity.\n",
      "     |      \n",
      "     |      It must be called at most once per thread object. It arranges for the\n",
      "     |      object's run() method to be invoked in a separate thread of control.\n",
      "     |      \n",
      "     |      This method will raise a RuntimeError if called more than once on the\n",
      "     |      same thread object.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from Thread:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  daemon\n",
      "     |      A boolean value indicating whether this thread is a daemon thread.\n",
      "     |      \n",
      "     |      This must be set before start() is called, otherwise RuntimeError is\n",
      "     |      raised. Its initial value is inherited from the creating thread; the\n",
      "     |      main thread is not a daemon thread and therefore all threads created in\n",
      "     |      the main thread default to daemon = False.\n",
      "     |      \n",
      "     |      The entire Python program exits when no alive non-daemon threads are\n",
      "     |      left.\n",
      "     |  \n",
      "     |  ident\n",
      "     |      Thread identifier of this thread or None if it has not been started.\n",
      "     |      \n",
      "     |      This is a nonzero integer. See the thread.get_ident() function. Thread\n",
      "     |      identifiers may be recycled when a thread exits and another thread is\n",
      "     |      created. The identifier is available even after the thread has exited.\n",
      "     |  \n",
      "     |  name\n",
      "     |      A string used for identification purposes only.\n",
      "     |      \n",
      "     |      It has no semantics. Multiple threads may be given the same name. The\n",
      "     |      initial name is set by the constructor.\n",
      "    \n",
      "    local = class _local(builtins.object)\n",
      "     |  Thread-local data\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __delattr__(self, name, /)\n",
      "     |      Implement delattr(self, name).\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  __setattr__(self, name, value, /)\n",
      "     |      Implement setattr(self, name, value).\n",
      "\n",
      "FUNCTIONS\n",
      "    Lock = allocate_lock(...)\n",
      "        allocate_lock() -> lock object\n",
      "        (allocate() is an obsolete synonym)\n",
      "        \n",
      "        Create a new lock object. See help(type(threading.Lock())) for\n",
      "        information about locks.\n",
      "    \n",
      "    RLock(*args, **kwargs)\n",
      "        Factory function that returns a new reentrant lock.\n",
      "        \n",
      "        A reentrant lock must be released by the thread that acquired it. Once a\n",
      "        thread has acquired a reentrant lock, the same thread may acquire it again\n",
      "        without blocking; the thread must release it once for each time it has\n",
      "        acquired it.\n",
      "    \n",
      "    active_count()\n",
      "        Return the number of Thread objects currently alive.\n",
      "        \n",
      "        The returned count is equal to the length of the list returned by\n",
      "        enumerate().\n",
      "    \n",
      "    current_thread()\n",
      "        Return the current Thread object, corresponding to the caller's thread of control.\n",
      "        \n",
      "        If the caller's thread of control was not created through the threading\n",
      "        module, a dummy thread object with limited functionality is returned.\n",
      "    \n",
      "    enumerate()\n",
      "        Return a list of all Thread objects currently alive.\n",
      "        \n",
      "        The list includes daemonic threads, dummy thread objects created by\n",
      "        current_thread(), and the main thread. It excludes terminated threads and\n",
      "        threads that have not yet been started.\n",
      "    \n",
      "    get_ident(...)\n",
      "        get_ident() -> integer\n",
      "        \n",
      "        Return a non-zero integer that uniquely identifies the current thread\n",
      "        amongst other threads that exist simultaneously.\n",
      "        This may be used to identify per-thread resources.\n",
      "        Even though on some platforms threads identities may appear to be\n",
      "        allocated consecutive numbers starting at 1, this behavior should not\n",
      "        be relied upon, and the number should be seen purely as a magic cookie.\n",
      "        A thread's identity may be reused for another thread after it exits.\n",
      "    \n",
      "    main_thread()\n",
      "        Return the main thread object.\n",
      "        \n",
      "        In normal conditions, the main thread is the thread from which the\n",
      "        Python interpreter was started.\n",
      "    \n",
      "    setprofile(func)\n",
      "        Set a profile function for all threads started from the threading module.\n",
      "        \n",
      "        The func will be passed to sys.setprofile() for each thread, before its\n",
      "        run() method is called.\n",
      "    \n",
      "    settrace(func)\n",
      "        Set a trace function for all threads started from the threading module.\n",
      "        \n",
      "        The func will be passed to sys.settrace() for each thread, before its run()\n",
      "        method is called.\n",
      "    \n",
      "    stack_size(...)\n",
      "        stack_size([size]) -> size\n",
      "        \n",
      "        Return the thread stack size used when creating new threads.  The\n",
      "        optional size argument specifies the stack size (in bytes) to be used\n",
      "        for subsequently created threads, and must be 0 (use platform or\n",
      "        configured default) or a positive integer value of at least 32,768 (32k).\n",
      "        If changing the thread stack size is unsupported, a ThreadError\n",
      "        exception is raised.  If the specified size is invalid, a ValueError\n",
      "        exception is raised, and the stack size is unmodified.  32k bytes\n",
      "         currently the minimum supported stack size value to guarantee\n",
      "        sufficient stack space for the interpreter itself.\n",
      "        \n",
      "        Note that some platforms may have particular restrictions on values for\n",
      "        the stack size, such as requiring a minimum stack size larger than 32kB or\n",
      "        requiring allocation in multiples of the system memory page size\n",
      "        - platform documentation should be referred to for more information\n",
      "        (4kB pages are common; using multiples of 4096 for the stack size is\n",
      "        the suggested approach in the absence of more specific information).\n",
      "\n",
      "DATA\n",
      "    TIMEOUT_MAX = 4294967.0\n",
      "    __all__ = ['get_ident', 'active_count', 'Condition', 'current_thread',...\n",
      "\n",
      "FILE\n",
      "    c:\\program files\\python36\\lib\\threading.py\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import threading\n",
    "help(threading)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = tf.constant([1.0, 2.0], name='a')\n",
    "b = tf.constant([2.0, 3.0], name='b')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3., 5.], dtype=float32)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result = a + b\n",
    "sess = tf.Session()\n",
    "sess.run(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
